{"ast":null,"code":"import _defineProperty from \"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/defineProperty.js\";\nimport _slicedToArray from \"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/slicedToArray.js\";\nimport React from 'react';\nimport { useToken } from '../theme/internal';\nexport var responsiveArray = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];\nvar getResponsiveMap = function getResponsiveMap(token) {\n  return {\n    xs: \"(max-width: \".concat(token.screenXSMax, \"px)\"),\n    sm: \"(min-width: \".concat(token.screenSM, \"px)\"),\n    md: \"(min-width: \".concat(token.screenMD, \"px)\"),\n    lg: \"(min-width: \".concat(token.screenLG, \"px)\"),\n    xl: \"(min-width: \".concat(token.screenXL, \"px)\"),\n    xxl: \"(min-width: \".concat(token.screenXXL, \"px)\")\n  };\n};\n/**\n * Ensures that the breakpoints token are valid, in good order\n * For each breakpoint : screenMin <= screen <= screenMax and screenMax <= nextScreenMin\n */\nvar validateBreakpoints = function validateBreakpoints(token) {\n  var indexableToken = token;\n  var revBreakpoints = [].concat(responsiveArray).reverse();\n  revBreakpoints.forEach(function (breakpoint, i) {\n    var breakpointUpper = breakpoint.toUpperCase();\n    var screenMin = \"screen\".concat(breakpointUpper, \"Min\");\n    var screen = \"screen\".concat(breakpointUpper);\n    if (!(indexableToken[screenMin] <= indexableToken[screen])) {\n      throw new Error(\"\".concat(screenMin, \"<=\").concat(screen, \" fails : !(\").concat(indexableToken[screenMin], \"<=\").concat(indexableToken[screen], \")\"));\n    }\n    if (i < revBreakpoints.length - 1) {\n      var screenMax = \"screen\".concat(breakpointUpper, \"Max\");\n      if (!(indexableToken[screen] <= indexableToken[screenMax])) {\n        throw new Error(\"\".concat(screen, \"<=\").concat(screenMax, \" fails : !(\").concat(indexableToken[screen], \"<=\").concat(indexableToken[screenMax], \")\"));\n      }\n      var nextBreakpointUpperMin = revBreakpoints[i + 1].toUpperCase();\n      var nextScreenMin = \"screen\".concat(nextBreakpointUpperMin, \"Min\");\n      if (!(indexableToken[screenMax] <= indexableToken[nextScreenMin])) {\n        throw new Error(\"\".concat(screenMax, \"<=\").concat(nextScreenMin, \" fails : !(\").concat(indexableToken[screenMax], \"<=\").concat(indexableToken[nextScreenMin], \")\"));\n      }\n    }\n  });\n  return token;\n};\nexport default function useResponsiveObserver() {\n  var _useToken = useToken(),\n    _useToken2 = _slicedToArray(_useToken, 2),\n    token = _useToken2[1];\n  var responsiveMap = getResponsiveMap(validateBreakpoints(token));\n  // To avoid repeat create instance, we add `useMemo` here.\n  return React.useMemo(function () {\n    var subscribers = new Map();\n    var subUid = -1;\n    var screens = {};\n    return {\n      matchHandlers: {},\n      dispatch: function dispatch(pointMap) {\n        screens = pointMap;\n        subscribers.forEach(function (func) {\n          return func(screens);\n        });\n        return subscribers.size >= 1;\n      },\n      subscribe: function subscribe(func) {\n        if (!subscribers.size) this.register();\n        subUid += 1;\n        subscribers.set(subUid, func);\n        func(screens);\n        return subUid;\n      },\n      unsubscribe: function unsubscribe(paramToken) {\n        subscribers.delete(paramToken);\n        if (!subscribers.size) this.unregister();\n      },\n      unregister: function unregister() {\n        var _this = this;\n        Object.keys(responsiveMap).forEach(function (screen) {\n          var matchMediaQuery = responsiveMap[screen];\n          var handler = _this.matchHandlers[matchMediaQuery];\n          handler === null || handler === void 0 ? void 0 : handler.mql.removeListener(handler === null || handler === void 0 ? void 0 : handler.listener);\n        });\n        subscribers.clear();\n      },\n      register: function register() {\n        var _this2 = this;\n        Object.keys(responsiveMap).forEach(function (screen) {\n          var matchMediaQuery = responsiveMap[screen];\n          var listener = function listener(_ref) {\n            var matches = _ref.matches;\n            _this2.dispatch(Object.assign(Object.assign({}, screens), _defineProperty({}, screen, matches)));\n          };\n          var mql = window.matchMedia(matchMediaQuery);\n          mql.addListener(listener);\n          _this2.matchHandlers[matchMediaQuery] = {\n            mql: mql,\n            listener: listener\n          };\n          listener(mql);\n        });\n      },\n      responsiveMap: responsiveMap\n    };\n  }, [token]);\n}","map":{"version":3,"names":["React","useToken","responsiveArray","getResponsiveMap","token","xs","screenXSMax","sm","screenSM","md","screenMD","lg","screenLG","xl","screenXL","xxl","screenXXL","validateBreakpoints","indexableToken","revBreakpoints","concat","reverse","forEach","breakpoint","i","breakpointUpper","toUpperCase","screenMin","screen","Error","length","screenMax","nextBreakpointUpperMin","nextScreenMin","useResponsiveObserver","responsiveMap","useMemo","subscribers","Map","subUid","screens","matchHandlers","dispatch","pointMap","func","size","subscribe","register","set","unsubscribe","paramToken","delete","unregister","Object","keys","matchMediaQuery","handler","mql","removeListener","listener","clear","_ref","matches","assign","window","matchMedia","addListener"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/antd/es/_util/responsiveObserver.js"],"sourcesContent":["import React from 'react';\nimport { useToken } from '../theme/internal';\nexport const responsiveArray = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];\nconst getResponsiveMap = token => ({\n  xs: `(max-width: ${token.screenXSMax}px)`,\n  sm: `(min-width: ${token.screenSM}px)`,\n  md: `(min-width: ${token.screenMD}px)`,\n  lg: `(min-width: ${token.screenLG}px)`,\n  xl: `(min-width: ${token.screenXL}px)`,\n  xxl: `(min-width: ${token.screenXXL}px)`\n});\n/**\n * Ensures that the breakpoints token are valid, in good order\n * For each breakpoint : screenMin <= screen <= screenMax and screenMax <= nextScreenMin\n */\nconst validateBreakpoints = token => {\n  const indexableToken = token;\n  const revBreakpoints = [].concat(responsiveArray).reverse();\n  revBreakpoints.forEach((breakpoint, i) => {\n    const breakpointUpper = breakpoint.toUpperCase();\n    const screenMin = `screen${breakpointUpper}Min`;\n    const screen = `screen${breakpointUpper}`;\n    if (!(indexableToken[screenMin] <= indexableToken[screen])) {\n      throw new Error(`${screenMin}<=${screen} fails : !(${indexableToken[screenMin]}<=${indexableToken[screen]})`);\n    }\n    if (i < revBreakpoints.length - 1) {\n      const screenMax = `screen${breakpointUpper}Max`;\n      if (!(indexableToken[screen] <= indexableToken[screenMax])) {\n        throw new Error(`${screen}<=${screenMax} fails : !(${indexableToken[screen]}<=${indexableToken[screenMax]})`);\n      }\n      const nextBreakpointUpperMin = revBreakpoints[i + 1].toUpperCase();\n      const nextScreenMin = `screen${nextBreakpointUpperMin}Min`;\n      if (!(indexableToken[screenMax] <= indexableToken[nextScreenMin])) {\n        throw new Error(`${screenMax}<=${nextScreenMin} fails : !(${indexableToken[screenMax]}<=${indexableToken[nextScreenMin]})`);\n      }\n    }\n  });\n  return token;\n};\nexport default function useResponsiveObserver() {\n  const [, token] = useToken();\n  const responsiveMap = getResponsiveMap(validateBreakpoints(token));\n  // To avoid repeat create instance, we add `useMemo` here.\n  return React.useMemo(() => {\n    const subscribers = new Map();\n    let subUid = -1;\n    let screens = {};\n    return {\n      matchHandlers: {},\n      dispatch(pointMap) {\n        screens = pointMap;\n        subscribers.forEach(func => func(screens));\n        return subscribers.size >= 1;\n      },\n      subscribe(func) {\n        if (!subscribers.size) this.register();\n        subUid += 1;\n        subscribers.set(subUid, func);\n        func(screens);\n        return subUid;\n      },\n      unsubscribe(paramToken) {\n        subscribers.delete(paramToken);\n        if (!subscribers.size) this.unregister();\n      },\n      unregister() {\n        Object.keys(responsiveMap).forEach(screen => {\n          const matchMediaQuery = responsiveMap[screen];\n          const handler = this.matchHandlers[matchMediaQuery];\n          handler === null || handler === void 0 ? void 0 : handler.mql.removeListener(handler === null || handler === void 0 ? void 0 : handler.listener);\n        });\n        subscribers.clear();\n      },\n      register() {\n        Object.keys(responsiveMap).forEach(screen => {\n          const matchMediaQuery = responsiveMap[screen];\n          const listener = _ref => {\n            let {\n              matches\n            } = _ref;\n            this.dispatch(Object.assign(Object.assign({}, screens), {\n              [screen]: matches\n            }));\n          };\n          const mql = window.matchMedia(matchMediaQuery);\n          mql.addListener(listener);\n          this.matchHandlers[matchMediaQuery] = {\n            mql,\n            listener\n          };\n          listener(mql);\n        });\n      },\n      responsiveMap\n    };\n  }, [token]);\n}"],"mappings":";;AAAA,OAAOA,KAAK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